﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Assets.Scenes.Script
{
    public class ConfigItem
    {
        /// <summary>
        /// 按钮名称
        /// </summary>
        public string btnName;
        /// <summary>
        /// 关键字
        /// </summary>
        public string rKey;
        /// <summary>
        /// 参数开始符
        /// </summary>
        public string pStartStr;
        /// <summary>
        /// 参数结束符
        /// </summary>
        public string pEndStr;
        /// <summary>
        /// 参数分隔符
        /// </summary>
        public string pSlipStr;
        /// <summary>
        /// 参数名称
        /// </summary>
        public string[] psName;
        /// <summary>
        /// 参数名称
        /// </summary>
        public string[] psValue;


        /// <summary>
        /// 备注
        /// </summary>
        public string pInFo;
        public ConfigItem()
        {
        }

        public string CMD { 
            get {
                if (psValue==null)
                {
                    return rKey;
                }

                string cmd = rKey+" "+ pStartStr;

                if (pSlipStr=="")
                {
                    pSlipStr = " ";
                }

                if (psValue!=null)
                    for (int i = 0; i < psValue.Length; i++)
                    {
                        cmd += psValue[i];
                        if (i != psValue.Length - 1) cmd += pSlipStr;
                    }

                cmd += pEndStr;
                cmd = cmd.Trim();
                return cmd;
            } 
        }
    }
}
